#pragma once
#include "define.h"
#include "tetromino.h"
#include "piece.h"
#include "utils.h"
#include "terminal.h"
#include "draw.h"
namespace gm
{
    //=========================================
    //游戏变量定义
    //=========================================
    extern bool running;
    extern bool lose;
    //分数
    extern int score;
    //消行数
    extern int lines;
    //当前等级
    extern int level;
    //前一消行等级
    extern int last_level;
    //当前掉落的方块
    extern Piece* one_piece;
    //游戏场地
    extern Matrix playField;
    //每帧时间间隔
    extern std::chrono::microseconds duration;
    //当前渲染帧
    extern Matrix frame;
    // 生成方块包
    extern std::vector<Tetromino*> bag7;
    extern Matrix nextPiece;
    extern Matrix holdPiece;
    extern Tetromino holdk;
    //=========================================
    //游戏逻辑
    //=========================================
    //主逻辑
    void process();
    //游戏初始化
    void init();
    //渲染当前帧
    void render();
    //获取一个块
    void pick(int x=4, int y=20);
    //锁定
    void lock();
    //消行
    void clear();
    //游戏结束
    void quit();
    //加速
    void speed_up();
    void rotate();
    void left();
    void right();
    void down();
    void drop();
    //暂存方块
    void hold();
    void help();


} // namespace gm
